/*
 * DialogoDescartes.java
 *
 * Created on 31 de marzo de 2008, 21:59
 */

package javamus;

/**
 *
 * @author  jose
 */
public class DialogoDescartes extends javax.swing.JDialog {
    MesaSwing p = null;
    /** Creates new form DialogoDescartes */
    public DialogoDescartes(java.awt.Frame parent, boolean modal, MesaSwing p) {
        super(parent, modal);
        this.p = p;
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jFrame1 = new javax.swing.JFrame();
        jCarta1 = new javax.swing.JToggleButton();
        jCarta2 = new javax.swing.JToggleButton();
        jCarta3 = new javax.swing.JToggleButton();
        jCarta4 = new javax.swing.JToggleButton();
        jDescartar = new javax.swing.JButton();

        javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());
        jFrame1.getContentPane().setLayout(jFrame1Layout);
        jFrame1Layout.setHorizontalGroup(
            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        jFrame1Layout.setVerticalGroup(
            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jCarta1.setText("CARTA 1");
        jCarta1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCarta1ActionPerformed(evt);
            }
        });

        jCarta2.setText("CARTA 2");

        jCarta3.setText("CARTA 3");

        jCarta4.setText("CARTA 4");

        jDescartar.setText("Descartar");
        jDescartar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jDescartarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jCarta1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCarta2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCarta3, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCarta4, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(134, 134, 134)
                        .addComponent(jDescartar, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCarta1, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jCarta2, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jCarta3, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jCarta4, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addComponent(jDescartar, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jDescartarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jDescartarActionPerformed
        // TODO add your handling code here:
        this.p.descartes = "";
        if (jCarta1.isSelected()) this.p.descartes = this.p.descartes + "1"; 
            else  this.p.descartes = this.p.descartes + "0"; 
        if (jCarta2.isSelected()) this.p.descartes = this.p.descartes + "1"; 
            else  this.p.descartes = this.p.descartes + "0";
        if (jCarta3.isSelected()) this.p.descartes = this.p.descartes + "1"; 
            else  this.p.descartes = this.p.descartes + "0";
        if (jCarta4.isSelected()) this.p.descartes = this.p.descartes + "1"; 
            else  this.p.descartes = this.p.descartes + "0";
        
        this.dispose();
}//GEN-LAST:event_jDescartarActionPerformed

    private void jCarta1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCarta1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jCarta1ActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                DialogoDescartes dialog = new DialogoDescartes(new javax.swing.JFrame(), true,null);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToggleButton jCarta1;
    private javax.swing.JToggleButton jCarta2;
    private javax.swing.JToggleButton jCarta3;
    private javax.swing.JToggleButton jCarta4;
    private javax.swing.JButton jDescartar;
    private javax.swing.JFrame jFrame1;
    // End of variables declaration//GEN-END:variables
    
}
